package com.study.xxxjob.job;

import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import org.springframework.stereotype.Component;

/**
 * @author flwu
 * @date 2020/3/17 7:40 PM
 * @MOTTO 保持空和敬畏
 */
@Component
public class SprintHelloJob {

    /**
     * 简单任务事例
     * @param param
     * @return
     */
    @XxlJob("sprintHello")
    public ReturnT<String> sprintHello(String param) {
        XxlJobLogger.log("hello");
        System.out.println("hello");
        return ReturnT.SUCCESS;
    }

    @XxlJob(value = "timeLine", init = "before", destroy = "end")
    public ReturnT<String> timeLine(String param) {
        System.out.println("middle");
        return ReturnT.SUCCESS;
    }

    /**
     * 方法开始前执行
     */
    public void before() {
        System.out.println("before");
    }

    /**
     * 进程结束时执行
     */
    public void end(){
        System.out.println("end");
    }
}
